<template>
  <p class="p">文章</p>
  <div class="essay" v-for="item in data.essaylist" :key="item">
    <div class="tabtop">
      <img class="img" :src="item.essaypic" alt="" />
      <div class="titles">
        <p class="title">
          {{ item.title }}
        </p>
        <p class="desc">
          {{ item.desc }}
        </p>
      </div>
    </div>
    <div class="tabbot">
      <div class="tabbotl">
        <img :src="item.headpic" alt="" />
        <span>{{ item.user }}</span>
      </div>
      <div class="tabbotr">
        <button>
          <van-icon class="icon" name="good-job-o" />
          <span>155</span>
        </button>
        <button>
          <van-icon class="icon" name="smile-comment-o" />
          <span>155</span>
        </button>
      </div>
    </div>
  </div>
  <div class="more">
    <p @click="jumpessay">更多相关文章<van-icon name="arrow" /></p>
  </div>
  <p class="p">话题</p>
  <div class="chat" v-for="item in data.chatlist" :key="item">
    <span class="chat1">#</span>
    <span class="chat2">{{ item.chat2 }}</span>
    <span class="chat3">{{ item.chat3 }}</span>
  </div>
  <div class="more">
    <p @click="jumpdiscus">更多相关话题<van-icon name="arrow" /></p>
  </div>
  <p class="p">帖子</p>
  <div class="discus" v-for="item in data.postlist" :key="item">
    <div class="tabtop">
      <p class="tabtop1">{{ item.tabtop1 }}</p>
      <p class="tabtop2">{{ item.tabtop2 }}</p>
    </div>
    <div class="tabbot">
      <div class="tabbotl">
        <img :src="item.headimg" alt="" />
        <span>{{ item.user }}</span>
      </div>
      <div class="tabbotr">
        <button>
          <van-icon class="icon" name="good-job-o" />
          <span>155</span>
        </button>
        <button>
          <van-icon class="icon" name="smile-comment-o" />
          <span>155</span>
        </button>
      </div>
    </div>
  </div>
  <div class="more">
    <p @click="jumpdiscus">更多相关帖子<van-icon name="arrow" /></p>
  </div>
  <p class="p">产品</p>
  <div class="prod" v-for="item in data.prodlist" :key="item">
    <div class="img">
      <img :src="item.prodimg" alt="" />
    </div>
    <div class="view">
      <p class="title">{{ item.title }}</p>
      <p class="desc">{{ item.desc }}</p>
      <span class="score">8.0</span>
      <img :src="item.star" alt="" />
      <span class="count">(1130人评分)</span>
      <p class="price">美国 ·￥140/ 15ml</p>
    </div>
  </div>
  <div class="more">
    <p @click="jumpprod">更多相关产品<van-icon name="arrow" /></p>
  </div>
  <p class="p">成分</p>
  <div class="elem" v-for="item in data.elemlist" :key="item">
    <div class="view">
      <p class="title"><span>视黄醇</span>丙酸脂</p>
      <p class="desc">{{ item.desc }}</p>
      <ul>
        <li>抗衰老</li>
        <li>美白祛斑</li>
        <li>抗氧化剂</li>
      </ul>
    </div>
    <div class="img">
      <img :src="item.img" alt="" />
    </div>
  </div>
  <div class="more">
    <p @click="jumpelem">更多相关成分<van-icon name="arrow" /></p>
  </div>
</template>

<script>
import { reactive } from "vue";
import { ref } from "vue";
import { useRouter } from "vue-router";
export default {
  setup() {
    const router = useRouter();
    const active = ref(0);
    const data = reactive({
      essaylist: [
        {
          essaypic: "http://121.40.124.132:3000/images/search/wenzhang.png",
          title: "抄作业 | 以视黄醇为主的routine参考",
          desc: "一套高效、全面的护肤方案",
          headpic: "http://121.40.124.132:3000/images/search/touxiang.png",
          user: "晨安睡不醒",
        },
        {
          essaypic: "http://121.40.124.132:3000/images/search/wenzhang.png",
          title: "抄作业 | 以视黄醇为主的routine参考",
          desc: "一套高效、全面的护肤方案",
          headpic: "http://121.40.124.132:3000/images/search/touxiang.png",
          user: "晨安睡不醒",
        },
        {
          essaypic: "http://121.40.124.132:3000/images/search/wenzhang.png",
          title: "抄作业 | 以视黄醇为主的routine参考",
          desc: "一套高效、全面的护肤方案",
          headpic: "http://121.40.124.132:3000/images/search/touxiang.png",
          user: "晨安睡不醒",
        },
      ],
      chatlist: [
        {
          chat2: "适合油皮的眼霜推荐",
          chat3: "39.1k条讨论",
        },
        {
          chat2: "大油田也别作死，过度清洁会烂脸",
          chat3: "1671条讨论",
        },
        {
          chat2: "白天脸上爱出油，吸油纸还是保湿喷雾",
          chat3: "1877条讨论",
        },
      ],
      postlist: [
        {
          tabtop1: "视黄醇",
          tabtop2: "#孕妇禁用的护肤品和化妆品成分",
          headimg: "http://121.40.124.132:3000/images/search/touxiang.png",
          user: "晨安睡不醒",
        },
        {
          tabtop1: "视黄醇",
          tabtop2: "#孕妇禁用的护肤品和化妆品成分",
          headimg: "http://121.40.124.132:3000/images/search/touxiang.png",
          user: "晨安睡不醒",
        },
        {
          tabtop1: "视黄醇",
          tabtop2: "#孕妇禁用的护肤品和化妆品成分",
          headimg: "http://121.40.124.132:3000/images/search/touxiang.png",
          user: "晨安睡不醒",
        },
      ],
      prodlist: [
        {
          prodimg: "http://121.40.124.132:3000/images/search/chanpin.png",
          title: "洛克RoC维A抗皱眼霜",
          desc: "RoC Retinol Correxion Eye Cream",
          star: "http://121.40.124.132:3000/images/search/xing.png",
        },
        {
          prodimg: "http://121.40.124.132:3000/images/search/chanpin.png",
          title: "洛克RoC维A抗皱眼霜",
          desc: "RoC Retinol Correxion Eye Cream",
          star: "http://121.40.124.132:3000/images/search/xing.png",
        },
        {
          prodimg: "http://121.40.124.132:3000/images/search/chanpin.png",
          title: "洛克RoC维A抗皱眼霜",
          desc: "RoC Retinol Correxion Eye Cream",
          star: "http://121.40.124.132:3000/images/search/xing.png",
        },
      ],
      elemlist: [
        {
          desc: "RETINYL PROPIONATE",
          img: "http://121.40.124.132:3000/images/search/hongdian.png",
        },
        {
          desc: "RETINYL PROPIONATE",
          img: "http://121.40.124.132:3000/images/search/hongdian.png",
        },
        {
          desc: "RETINYL PROPIONATE",
          img: "http://121.40.124.132:3000/images/search/hongdian.png",
        },
      ],
    });
    const jumpessay = () => {
      router.push("essay");
    };
    const jumpdiscus = () => {
      router.push("discus");
    };
    const jumpprod = () => {
      router.push("prod");
    };
    const jumpelem = () => {
      router.push("elem");
    };
    return {
      data,
      active,
      jumpessay,
      jumpdiscus,
      jumpprod,
      jumpelem,
    };
  },
};
</script>

<style lang="less">
.van-sticky {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 58px;
  width: 391px;
}
.van-tab__pane {
  margin-top: 120px;
}
</style>
<style lang="less" scoped>
.essay {
  border-bottom: 1px solid #eee;
  .tabtop {
    padding: 12.5px 16px 0;
    margin-bottom: 5px;
    overflow: hidden;
    .img {
      float: left;
      width: 83px;
      height: 54px;
      margin-right: 13px;
    }
    .titles {
      width: 246px;
      float: left;
      .title {
        font-size: 14px;
        font-weight: 600;
        line-height: 20px;
        color: #535353;
      }
      .desc {
        font-size: 12px;
        line-height: 20px;
        color: #8b8b8b;
      }
    }
  }
  .tabbot {
    padding: 5px 16px 10px;
    .tabbotl {
      display: inline-block;
      height: 20px;
      img {
        width: 15px;
        height: 15px;
        float: left;
      }
      span {
        line-height: 15px;
        font-size: 12px;
        font-weight: 900;
        color: #6d6d6d;
        vertical-align: top;
      }
    }
    .tabbotr {
      float: right;
      height: 20px;
      .icon {
        font-size: 14px;
        float: left;
        color: #b9b9b9;
      }
      span {
        font-size: 1px;
        float: left;
        margin-left: 5px;
        color: #b9b9b9;
      }
      button {
        margin: 0 10px;
        border: none;
        background: #fff;
      }
    }
  }
}
.discus {
  .tabtop {
    padding: 0 16px;
    .tabtop1 {
      font-size: 14px;
      font-weight: 900;
      color: #68dcdc;
      line-height: 23px;
    }
    .tabtop2 {
      font-size: 12px;
      color: #bdbdbd;
      line-height: 20px;
    }
  }
  .tabbot {
    padding: 5px 16px 10px;
    .tabbotl {
      display: inline-block;
      height: 20px;
      img {
        width: 15px;
        height: 15px;
        float: left;
      }
      span {
        line-height: 15px;
        font-size: 12px;
        font-weight: 900;
        color: #6d6d6d;
        vertical-align: top;
      }
    }
    .tabbotr {
      float: right;
      height: 20px;
      .icon {
        font-size: 14px;
        float: left;
        color: #b9b9b9;
      }
      span {
        font-size: 1px;
        float: left;
        margin-left: 5px;
        color: #b9b9b9;
      }
      button {
        margin: 0 10px;
        border: none;
        background: #fff;
      }
    }
  }
}
.p {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 10px 16px;
}
.chat {
  margin-left: 16px;
  line-height: 34px;
  .chat1 {
    font-size: 14px;
    color: #78cccd;
    margin-right: 5px;
  }
  .chat2 {
    font-size: 14px;
    font-weight: 900;
    margin-right: 30px;
  }
  .chat3 {
    font-size: 1px;
    color: #acacac;
  }
}
.prod {
  padding: 12px 16px 15px;
  border-bottom: 1px solid #eee;
  .img {
    display: inline-block;
    margin-right: 12px;
  }
  .view {
    display: inline-block;
    .title {
      font-size: 16px;
      font-weight: 900;
      line-height: 30px;
    }
    .desc {
      font-size: 1px;
      color: #999;
      line-height: 16px;
    }
    .score {
      font-size: 14px;
      color: #68dcdc;
      line-height: 24px;
      margin-right: 8px;
    }
    .count {
      font-size: 14px;
      color: #666;
      margin-left: 16px;
    }
    .price {
      font-size: 1px;
      color: #999;
    }
  }
}
.elem {
  padding: 12px 16px 10px;
  border-bottom: 1px solid #eee;
  overflow: hidden;
  .view {
    float: left;
    .title {
      font-size: 14px;
      font-weight: 900;
      line-height: 24px;
      span {
        color: #68dcdc;
      }
    }
    .desc {
      font-size: 1px;
      color: #999;
      line-height: 20px;
    }
    ul {
      display: flex;
      justify-content: space-between;
      width: 210px;
      li {
        display: inline-block;
        padding: 5px 8px;
        border: 1px solid #68dcdc;
        border-radius: 14px;
        color: #68dcdc;
        font-size: 12px;
      }
    }
  }
  .img {
    float: right;
    img {
      margin-top: 28px;
    }
  }
}
.more {
  width: 345.5px;
  height: 37px;
  border: 0.5px solid #ccc;
  font-size: 13px;
  color: #919191;
  margin-left: 15px;
  p {
    line-height: 37px;
    text-align: center;
  }
}
</style>
